<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="author" content="" />
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<title> new document </title>
		<style>
			.box {
				width: 200px;
				border: 1px outset #CCC;
				padding-top: 30px;
				margin: 50px auto;
			}
			.box div {
				width: 60%;
				border: 1px solid red;
			}
		</style>
	</head>
	<body>
		<div id="box" class="box">
			<div class="inner">
				1
			</div>
			<b class="inner">2</b>
		</div>

		<script>
			function matchesElement(e, selector, fun) {
				if (this.matchesSelector && t.matchesSelector(selector) || this.webkitMatchesSelector && this.webkitMatchesSelector(selector) || this.mozMatchesSelector && this.mozMatchesSelector(selector) || this.oMatchesSelector && this.oMatchesSelector(selector) || this.msMatchesSelector && this.msMatchesSelector(selector)) {
					fun.call(this, e);
				}
			}


			Element.prototype.on = function(type, selector, fun) {
				var fun2 = typeof selector == "string" ? function(e) {
					e.target == this || matchesElement.call(e.target, e, selector, fun);
				} : selector;
				this.addEventListener(type, fun2, false);
			};

			/* 绑定事件 */
			document.getElementById("box").on("click", ".inner", function() {
				alert(this.innerHTML)
			});

		</script>
	</body>
</html>